'use strict';

angular.module('ProduceReady').controller('MOListController', ['$scope', 'BaseService', 'PublicModule', 'PublicEnum', 'PublicFunction', 'BarcodeEnum', '$location', 'Authentication',
    function($scope, BaseService, PublicModule, PublicEnum, PublicFunction, BarcodeEnum, $location, Authentication) {
        BaseService.getExtendEnum('ItemCategory', function(extendEnum){
            $scope.ItemCategoryEnum = extendEnum;
        });

    	PublicModule.initModule($scope, 'MO');
        $scope.Module.MO.LoadMode = PublicEnum.LoadMode.CacheAndPaging;
        $scope.Module.MO.Populate = [{path: 'ItemMaster', select: 'Code Name'}];
        $scope.Module.MO.PageSize = 15;

        $scope.btnAdd = function(){
        	$location.url('/index/MO/Edit');
        };

        $scope.rowDblClick = function(){
            $scope.$apply(function(){
                $location.url("/index/MO/Edit/" + $scope.Module.MO.FocusedRecord._id);
            });
        };

        $scope.btnDelete = function(){
        	$scope.Module.MO.deleteSelecteds();
        };
    }
]);